package com.cratos.xxgram.platf.complaint;

import java.util.HashMap;
import java.util.Map;

/**
 * 举报类型
 * @author fk
 */
public enum ComplaintType {

	SQSR(0, "色情骚扰"),
	GGAO(1, "广告"),
	QZA(2, "欺诈"), 
	QQUAN(3, "侵权"),
	ZHBDY(4, "账号被盗用"),
	WFXWDBFD(5, "违法行为(赌博，反动)"),
	QTWFXW(6, "其他违法行为");

	private int code;

	private String desc;

	public int getCode() {
		return code;
	}


	public String getDesc() {
		return desc;
	}


	public void setDesc(String desc) {
		this.desc = desc;
	}


	public void setCode(int code) {
		this.code = code;
	}

	ComplaintType(int code, String desc) {
		this.code = code;
		this.desc = desc;
	}

	/**
	 * 自己定义一个静态方法,通过code返回枚举常量对象
	 * 
	 * @param code
	 * @return
	 * @throws UnsupportedDataTypeException 
	 */
	public static ComplaintType getValue(int code)  {
		for (ComplaintType type : values()) {
			if (code == type.code) {
				return type;
			}
		}
		throw new RuntimeException("unsupport file type ...");
	}
	
	public static Map<Integer, String> toMaps() {
		ComplaintType[] data = values();
		 Map<Integer, String> dataMap = new HashMap<Integer, String>(data.length);
		 for(ComplaintType type : data) {
			 dataMap.put(type.code, type.desc);
		 }
		 return dataMap;
	}
}
